//
//  UIButton+Extension.swift
//  sinaWeibo
//
//  Created by LiHong on 15/11/1.
//  Copyright © 2015年 LiHong. All rights reserved.
//

import UIKit

extension UIButton {
    convenience init(imageName: String, title: String, titleColor: UIColor = UIColor.lightGrayColor(), fontSize: CGFloat = 12){
        self.init()
        
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        setTitle(title, forState: UIControlState.Normal)
        setTitleColor(titleColor, forState: UIControlState.Normal)
        titleLabel?.font = UIFont.systemFontOfSize(fontSize)
        
        
    }
    
    convenience init(bkgImage: String, title: String, titleColor: UIColor, fontSize: CGFloat) {
        self.init()
        setBackgroundImage(UIImage(named: bkgImage), forState: UIControlState.Normal)
        
        setTitle(title, forState: UIControlState.Normal)
        
        setTitleColor(titleColor, forState: UIControlState.Normal)
        titleLabel?.font = UIFont.systemFontOfSize(fontSize)
    }
}